class UsersTable < ActiveRecord::Migration
  def self.up
    create_table :users do |table|
      table.column :user, :string, :limit => 80, :default => nil, :null => false
      table.column :password, :string, :limit => 40, :default => nil, :null => false
      table.column :firstname, :string, :limit => 100, :default => nil
      table.column :lastname, :string, :limit => 100, :default => nil
    end
    
    create_table :groups do |table|
      table.column :groupname, :string, :limit => 100, :default => nil, :null => false 
    end
    
    create_table :users_groups do |table|
      table.column :user_id, :integer
      table.column :group_id, :integer
    end
  end

  def self.down
    drop_table :users
    drop_table :groups
    drop_table :users_groups
  end
end
